package crudfx.navigation;
import javax.swing.*;
import java.awt.event.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class MenuChildren extends MenuPad{
    public var text:String on replace {menuItem.setText(text);};
    public var icon:javax.swing.Icon=null on replace{menuItem.setIcon(icon);};
    var menuItem:JMenu;
    public var content:MenuPad[] on replace {setItems();};
    override public function addPopUp(popup:JPopupMenu):Void{popup.add(menuItem);}
    override public function addMenu(menu:JMenu):Void{menu.add(menuItem);}
    init{
        menuItem=new JMenu();
        menuItem.setText(text);
        menuItem.setIcon(icon);
        setItems();
        }
    function setItems(){
        menuItem.removeAll();
        for(i:MenuPad in content){i.addMenu(menuItem);}
        }
    }
